<?php 
require_once("connect.php");
class banners {

  function mainslider(){
  	$todaydate = date("Y-m-d");
	$query = "select id, title, pageurl, code, 'order', metatag, startdate, enddate from banner where type = 2 and isactive = 1 and isdelete = 0 and enddate > '".$todaydate. "' order by enddate";
	$total_rows = mysql_num_rows(mysql_query($query));
	
	if($total_rows > 0){
		$result = mysql_query($query);
	    while($row = mysql_fetch_array($result))
		{
		   echo $row["code"];
		   echo "<div class=\"SliderName_2Description\"><strong>". $row["metatag"] ."</strong></div>";
		}
	}
	else 
	{
	  echo "<img src=\"images/slider/tarkan.jpg\" width=\"530\" height=\"330\" alt=\"tarkan\" title=\"tarkan\" />";
	  echo "<div class=\"SliderName_2Description\"><strong>Su anda bir etkinlligimiz bulunmamaktadir...</strong></div>";
	}
  }
  
  function rightbanner(){
  	$todaydate = date("Y-m-d");
	$query = "select id, title, pageurl, code, 'order', metatag, startdate, enddate from banner where type = 1 and isactive = 1 and isdelete = 0 and enddate > '".$todaydate. "' order by enddate";
	$total_rows = mysql_num_rows(mysql_query($query));
	
	if($total_rows > 0){
		$result = mysql_query($query);
	    while($row = mysql_fetch_array($result))
		{
		   echo $row["code"];
		}
	}
	else 
	{
	  echo "<img src=\"images/ad/banner1.png\" width=\"120\" height=\"600\" alt=\"tarkan\" title=\"tarkan\" />";
	}
  }
  
  function sliderbottombanner(){
     $todaydate = date("Y-m-d");
     $query = "select id, title, pageurl, code, 'order', metatag, startdate, enddate from banner where type = 3 and isactive = 1 and isdelete = 0 and enddate > '".$todaydate. "' order by enddate";
     $total_rows = mysql_num_rows(mysql_query($query));
	
     if($total_rows > 0){
        $result = mysqlquery($query);
        $marginplus = 0; 
        while($row = mysql_fetch_array($result))
	{
	   echo "<div id=\"ad-250-250\" style=\"margin-left:". $marginplus."px\">" . $row["code"]. "</div>";
           $marginplus = $marginplus + 30;
	}
	}
	else 
	{
	  echo "<div id=\"ad-250-250\">
                  <img src=\"images/ad/250-250-2.jpg\">
                </div>
                <div id=\"ad-250-250\">
                  <img src=\"images/ad/250-250-1.png\">
                </div>";
	}
  }
  
}
$banners = new banners();
?>